package model.librairie;

import model.social.*;
import java.util.*; 

public class Collection {

    protected int id_collection;
    protected String nom;
    protected double note;
    protected String description;
    protected Date dateAjout;
    protected Date dateModif;
    protected int nbNotes;
    protected Set<CommentaireCol> listeCommentCol=new HashSet<CommentaireCol>(0);
    protected Set<Article> listeArticles=new HashSet<Article>(0);    
    protected Utilisateur util;

    public Collection()   {    	
    }
    
    public Collection(String nom, double note,
			String description, Date dateAjout, Date dateModif) {
		this.nom = nom;
		this.note = note;
		this.description = description;
		this.dateAjout = dateAjout;
		this.dateModif = dateModif;
		this.nbNotes=0;		
	}

	public void ajouterArticle ( Article article) {
        listeArticles.add(article);
    }

    public ArrayList<Article> rechercherArticles ( String libelle) {
        return null;
    }

    public void supprimerArticle ( int id_article) {
      /*  for (int i = 0; i<listeArticles.size(); i++) {
        	if (listeArticles.get(i).getId_article()==id_article) {
        		listeArticles.remove(i);
        	}	
        }
        */
    }

    public void noter(int note) {
        this.note = ((this.note*this.nbNotes)+note) / (this.nbNotes+1);
        this.nbNotes++;        
    }

    public void ajouterCommentaire(CommentaireCol com){
    	listeCommentCol.add(com);
    }
    
    public void signaler() {
    }
    
    public void modifierCollection (String nom, String description,	Set<Article> listeArticles) {
		this.nom = nom;
		this.description = description;
		this.listeArticles = listeArticles;
    }

	public int getId_collection() {
		return id_collection;
	}

	public void setId_collection(int id_collection) {
		this.id_collection = id_collection;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public double getNote() {
		return note;
	}

	public void setNote(double note) {
		this.note = note;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public Utilisateur getUtil() {
		return util;
	}

	public void setUtil(Utilisateur util) {
		this.util = util;
	}	

	public Date getDateAjout() {
		return dateAjout;
	}

	public void setDateAjout(Date dateAjout) {
		this.dateAjout = dateAjout;
	}

	public Date getDateModif() {
		return dateModif;
	}

	public void setDateModif(Date dateModif) {
		this.dateModif = dateModif;
	}

	public int getNbNotes() {
		return nbNotes;
	}

	public void setNbNotes(int nbNotes) {
		this.nbNotes = nbNotes;
	}

	public Set<CommentaireCol> getListeCommentCol() {
		return listeCommentCol;
	}

	public void setListeCommentCol(Set<CommentaireCol> listeCommentCol) {
		this.listeCommentCol = listeCommentCol;
	}

	public Set<Article> getListeArticles() {
		return listeArticles;
	}

	public void setListeArticles(Set<Article> listeArticles) {
		this.listeArticles = listeArticles;
	}

    
}

